<template>
  <div id="app">
    <router-view class="main"></router-view>
    <router-home>
      <el-menu
      :default-active="activeIndex2"
      class="el-menu-demo"
      mode="horizontal"
      @select="handleSelect"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b"
    >
      <el-menu-item index="1" class="index_nav_left">ERP系统首页</el-menu-item>
      <el-submenu index="2" class="index_nav_right">
        <template slot="title">我的工作台</template>
        <el-menu-item index="2-1">选项1</el-menu-item>
        <el-submenu index="2-4">
          <template slot="title">选项4</template>
          <el-menu-item index="2-4-1">选项1</el-menu-item>
          <el-menu-item index="2-4-2">选项2</el-menu-item>
          <el-menu-item index="2-4-3">选项3</el-menu-item>
        </el-submenu>
      </el-submenu>
      <el-menu-item index="3" class="index_nav_right">消息中心</el-menu-item>
      <el-menu-item index="4" class="index_nav_right">
        <a href="https://www.ele.me" target="_blank">用户登录</a>
      </el-menu-item>
    </el-menu>
    <el-row class="tac">
      <el-col :span="4">
        <!-- <h5>自定义颜色</h5> -->
        <el-menu
          default-active="2"
          class="el-menu-vertical-demo"
          @open="handleOpen"
          @close="handleClose"
          background-color="#545c64"
          text-color="#fff"
          active-text-color="#ffd04b"
        >
          <el-menu-item index="1" @click="rePurchase()">
            <template slot="title">
              <i class="el-icon-menu"></i>
              <span>采购申请</span>
            </template>
          </el-menu-item>
          <el-menu-item index="2">
            <i class="el-icon-menu"></i>
            <span slot="title">物料信息</span>
          </el-menu-item>
          <el-menu-item index="3" disabled>
            <i class="el-icon-document"></i>
            <span slot="title">导航三</span>
          </el-menu-item>
          <el-menu-item index="4">
            <i class="el-icon-setting"></i>
            <span slot="title">导航四</span>
          </el-menu-item>
        </el-menu>
      </el-col>
    </el-row>
    </router-home>
  </div>
</template>

<script>


export default {
  data() {
    return {
      activeIndex: "1",
      activeIndex2: "1",
    };
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
    handleSelect(key, keyPath) {
      console.log(key, keyPath);
    },
    rePurchase() {
      alert('填写采购申请单')
      this.$router.replace('purchase')
      // this.$router.push({path:'purchase'});
    }
  },
};

</script>

<style>
.index_nav_left {
  float: left;
}
.index_nav_right {
  float: right;
}
</style>


// 渲染的是login和home里面的组件